<template>

<div>

    <div style="width: 200px;height: 150px;border: 1px blue solid;">

        <p style="color: brown;">弟弟</p>

        <!-- <p>{{ c }}</p> -->
      <el-input v-model="c" placeholder="请输入" size="default" clearable ></el-input>


<el-button type="primary" size="default" @click="send2gg">发给-哥哥</el-button>

    </div>
</div>
</template>
<script>
import bus from '@/utils/mittBus.js';

export default{
    data(){
        return{
            c:'456'
        }
    },
    methods:{
        send2gg(){
            console.log('--send2gg---',this.c)
            //发布mitt事件
            bus.emit('evtSend2gg',this.c)
        }
    },
    mounted(){
        //订阅mitt事件
        bus.on('evtSend2dd',(e)=>{
                console.log('bus-receive-from-gg-')
                console.log(e)
                this.c = e;

            });
    },
    beforeUnmount(){
        //off移除事件
        bus.off('evtSend2gg')

        //移除所有事件
        // bus.all.clear();
    }


}

</script>
<style>
</style>